import 'dart:convert';

import 'package:logger/logger.dart';

import '../../service/DataChangeService.dart';
import '../../util/ImSingleton.dart';
import '../dto/base/Resp.dart';
import '../dto/business/SendData.dart';
import 'InitRouter.dart';

class HeartCheckRouter {

  final _logger = Logger(printer: PrettyPrinter(),);

  void initCallback(Map<String, CallbackData> callbackMap) {
    callbackMap.putIfAbsent("pingToClient", ()=> CallbackData(decodeFunction: PingReq.fromJson, doFunction: pingToClient));
  }

  /// 接受服务端消息
  Future<PongResp> pingToClient(PingReq pingReq) async {
    _logger.i("pong: ${jsonEncode(pingReq)}");
    return PongResp();
  }

}